//显示快捷键清单
function displayAccesskeys(){
    //获取所有链接
    let links = document.getElementsByTagName("a")
    //创建数组用于保存访问键
    let akeys = new Array()
    //遍历链接
    for(let i=0;i<links.length;i++){
        let currrent_link = links[i]
        if(!currrent_link.getAttribute("accesskey")){
            continue
        }
        //获取accesskey的值
        let key = currrent_link.getAttribute("accesskey")
        //获取链接文本
        let text = currrent_link.lastChild.nodeValue
        //添加到数组
        akeys[key] = text
    }
    //创建列表
    let list = document.createElement("ul")
    //遍历访问键
    for(key in akeys){
        let text = akeys[key]
        //创建放到列表项中的字符串
        let str = key + ':' + text
        //创建列表项
        let item = document.createElement("li")
        let item_text = document.createTextNode(str)
        item.appendChild(item_text)
        list.appendChild(item)
    }
    //创建标题
    let header = document.createElement("h3")
    let header_text = document.createTextNode("Accesskeys")
    header.appendChild(header_text)
    //将标题添加至页面主体
    document.body.appendChild(header)
    //将列表添加至页面主体
    document.body.appendChild(list)
}
addLoadEvent(displayAccesskeys)